home *** CD-ROM | disk | FTP | other *** search
/ Steal This CD / steal_this_cd.iso / Chapter 07 - Where the Hackers Are / virc200.exe / {app} / versus.txt < prev    next >
Text File  |  2003-08-30  |  35KB  |  964 lines

  1. VSInterp Scripting Reference - Versus
  2. Jesse McGrew
  3.  
  4. From a scripter's perspective, the Versus language can be divided into four
  5. parts: evaluating variable and function references in text; evaluating
  6. numerical expressions; running commands; and processing loops and statements.
  7.  
  8. Evaluating Variable and Function References (ParseVars)
  9. =======================================================
  10.  
  11. Strings of text are often evaluated to expand embedded references and
  12. substitutions. This process has two parts. First, backslash substitutions are
  13. performed, which map a backslash followed by a letter into a single ASCII
  14. character:
  15.  
  16.   \A       CTCP delimiter (^A, ASCII 1)
  17.   \L       newline or BIRC hyperlink character (^J, ASCII 10)
  18.   \S       carriage return or BIRC script link character (^M, ASCII 13)
  19.   \b       bold (^B, ASCII 2)
  20.   \k       color (^C, ASCII 3)
  21.   \t       tab (^I, ASCII 9)
  22.   \o       normal (^O, ASCII 15)
  23.   \r       reverse (^R, ASCII 18)
  24.   \i       italic (^V, ASCII 22)
  25.   \u       underline (^_, ASCII 31)
  26.  
  27. Next, dollar sign references (functions and variables) are expanded. These
  28. references are possible:
  29.  
  30.   $$
  31.     changes to a single dollar sign.
  32.   $0 through $9
  33.     changes to the value of the named pseudovariable.
  34.   $0- through $9-
  35.     changes to the value of the named pseudovariable list. $5- is the same
  36.     as $5 $6-, or $5 $6 $7-, etc. $9- contains $9 and any words following it.
  37.   $varname
  38.     changes to the value of the named variable. variable names are
  39.     case-sensitive. if there is no variable by that name, it will remain
  40.     unchanged. the parser picks the longest matching variable name: for
  41.     example, if there is a variable named $foo but none named $food, "$food"
  42.     will evaluate to the value of $foo followed by the letter "d".
  43.   $'$varname'
  44.     changes to the value of the variable whose name is in the named variable.
  45.     for example, if $varname contains "foo", $'$varname' will return the
  46.     value of $foo.
  47.   ${text}
  48.     recursively evaluates the text, then changes to the value of the variable
  49.     with that name. for example, if $varname contains "5", ${foo$varname}
  50.     will return the value of $foo5.
  51.   $arrayname.text
  52.     recursively evaluates the text, then changes to the value of the variable
  53.     whose name is arrayname followed by a dot and the result of the
  54.     evaluation. for example, if $varname contains "5", $foo.$varname will
  55.     return the value of $foo.5.
  56.   $funcname(text)
  57.     recursively evaluates the text, runs the named function (giving the text
  58.     as parameters), and changes to the function's return value. if there is
  59.     no function by that name, or if the function is an alias that returns no
  60.     value, the return value will be "<no value>".
  61.   $(text)
  62.     interprets the text as a numerical expression (see the next section).
  63.   $?="message|default value"
  64.     this is the input box pseudofunction. it displays a dialog box with the
  65.     message in the window and an input line where the user can type text. if
  66.     the vertical bar and default value are omitted, the input line will be
  67.     empty; otherwise, it will contain the default value. the pseufunction
  68.     reference is then changed into the text typed on the input line, or the
  69.     string "INPUT_CANCELLED" if the user cancelled by pushing Escape or Cancel.
  70.     if the same pseudofunction reference appears more than once in the text
  71.     (with the same message and default value), the box will only be displayed
  72.     once.
  73.  
  74. The variable $null is predefined to equal an empty string. In addition,
  75. $scriptdialect is predefined to the string "Versus", and $scripthost is a
  76. string describing the application running the script.
  77.  
  78. Evaluating Numerical Expressions
  79. ================================
  80.  
  81. Numerical expressions are used as conditions in loops and by the $() construct.
  82. These are standard algebraic expressions, with the following operators in order
  83. from lowest to highest precedence (operators on the same line have equal
  84. precedence):
  85.  
  86.   !! &&                boolean or, and
  87.   == != <= >= < >      equals, does-not-equal, less-or-equal, 
  88.                        greater-or-equal, less-than, greater-than
  89.   + -                  add, subtract
  90.   * / %                multiply, divide, remainder
  91.   | & ^                bitwise or, and, xor
  92.   << >>                bitwise shift left, shift right
  93.   ^^                   exponent
  94.   ~ - !  [unary]       bitwise not, arithmetic negation, boolean not
  95.  
  96. For example, -5*4+2 will be evaluated as ((-5)*4)+2, or -18. Boolean and
  97. comparison operators return 0 (false) or 1 (true). All binary operators are
  98. left-associative: 1-2-3 is evaluated as (1-2)-3.
  99.  
  100. Strings can also be compared by enclosing them in [square brackets]:
  101.  
  102.   [a] == [b]           check for equality, ignoring case
  103.   [a] === [b]          check for equality, matching case
  104.   [a] != [b]           check for inequality, ignoring case
  105.   [a] !== [b]          check for inequality, matching case
  106.   [a] < [b]            does "a" come before "b", ignoring case?
  107.   [a] <= [b]           does "a" come at or before "b", ignoring case?
  108.   [a] > [b]            does "a" come after "b", ignoring case?
  109.   [a] >= [b]           does "a" come at or after "b", ignoring case?
  110.  
  111. When a numerical expression is used as a condition, any nonzero value is true
  112. and zero is false.
  113.  
  114. Numbers can be specified as either signed decimal integers (123, -500, etc.)
  115. or unsigned hexadecimal numbers prefixed with a dollar sign ($FF, $20, etc.).
  116. Since the dollar sign also introduces a variable reference, the dollar sign
  117. before a hex number should be doubled to prevent unwanted evaluations:
  118.   $$FF + $$1
  119.  
  120. Running Commands
  121. ================
  122.  
  123. A command is a line of text that describes an action to be performed without
  124. altering the flow of execution. Commands can be prefixed with the characters
  125. ^ and/or * (in that order), which suppress text output and alias matching
  126. respectively. Command names are case-insensitive. Commands are described in
  127. the reference table at the end of this document.
  128.  
  129. Normally a command is evaluated before it is run. In addition to commands
  130. described in the table, these special forms are also available, and are not
  131. evaluated before they are run:
  132.  
  133.   $varname++
  134.     increments the value of $varname by 1.
  135.   $varname--
  136.     decrements the value of $varname by 1.
  137.   $varname += num
  138.     increments the value of $varname by <num>, which must be an integer
  139.     constant.
  140.   $varname -= num
  141.     decrements the value of $varname by <num>.
  142.   @ $varname = text
  143.     evaluates the text, then assigns it to the global variable $varname.
  144.     this value of $varname will be available in every alias, event, and menu
  145.     item. $varname can also be of the form $arrayname.text as described in
  146.     the first section.
  147.   @s $varname = text
  148.     same as above, but this value will be stored so that it's still available
  149.     the next time the program is run.
  150.   -@ $varname
  151.     deletes the global variable $varname.
  152.   -@s $varname
  153.     deletes the global variable $varname and removes it from storage so that
  154.     it won't be back next time the program is run.
  155.   @l $varname = text
  156.     (that's the letter L as in Local)
  157.     evaluates the text, then assigns it to the local variable $varname. this
  158.     value of $varname will only be available in the current alias, event, or
  159.     menu item, and it will mask out any global variable by that name as long
  160.     as it exists. There is no -@l because local variables are automatically
  161.     deleted when their enclosing routine exits.
  162.  
  163. Processing Loops and Statements
  164. ===============================
  165.  
  166. Loops and statements are constructs that span more than one line or alter the
  167. flow of execution. They may contain commands, and a command is always permitted
  168. wherever a loop or statement is, but a loop or statement isn't permitted
  169. everywhere that a command is.
  170.  
  171. The first line of a loop or statement can always be prefixed with 'Eval' to
  172. cause it to be evaluated.
  173.  
  174. Break [if <condition>]
  175.  
  176.   Exits the innermost loop. If a condition is specified, the loop is only
  177.   exited when the condition is true.
  178.  
  179. Continue [if <condition>]
  180.  
  181.   Skips the rest of the code in the innermost loop and runs through the loop
  182.   again. If the loop has an increment part ('for' and 'foreach'), it will be
  183.   run before the next iteration of the loop. If a condition is specified,
  184.   the loop is only exited when the condition is true.
  185.  
  186. Halt [if <condition>]
  187.  
  188.   Exits immediately from the current alias, event, or menu item. If a
  189.   condition is specified, the routine is only exited when the condition is
  190.   true.
  191.  
  192. Alias <name> [<hotkey>]
  193. <code>
  194. EndAlias
  195.  
  196.   Creates an alias with the given name, hotkey, and code (the host
  197.   application may not support hotkeys). The alias can be called just like
  198.   a command or function: parameters will be broken into words and passed
  199.   in as $1 through $9. $1- contains $1 and all the words after it, and so on.
  200.   $0 contains the name of the alias as it was called; the first character of $0
  201.   will be % if it was called as a function.
  202.   
  203.   If the alias is a function, it can return a value by assigning it to the
  204.   global variable $fresult. The variable's value will not be overwritten by
  205.   intervening function calls; it will be saved before a function call and
  206.   restored afterward.
  207.  
  208.  
  209. Event <name> "<mask>"
  210. <code>
  211. EndEvent
  212.  
  213.   Creates an event with the given name, mask, and code. The event will be
  214.   called by the host application when it sees fit (typically when some kind
  215.   of application-specific event happens that is described by <mask>). The
  216.   host application may not support events.
  217.  
  218. Parse [extended] <text>
  219. <code>
  220. EndParse
  221.  
  222.   Breaks <text> up into words, assigns them to the pseudovariables $0 through
  223.   $9 (and $0- through $9-), and runs <code> with the modified
  224.   pseudovariables. If the 'extended' keyword is specified, the text will be
  225.   split up like list elements instead of simple words (see the section later
  226.   about list functions).
  227.  
  228. If <condition>
  229. <code>
  230. [ElseIf <condition>
  231. <code>]
  232. [Else
  233. <code>]
  234. EndIf
  235.  
  236.   Executes <code> if the condition is true. If one or more ElseIf sections
  237.   are given and the condition is false, flow of execution will proceed to
  238.   the first section whose condition is true, skipping the rest of the
  239.   sections. If none of the conditions are true and an Else section is
  240.   specified, it will be run.
  241.  
  242. While [optimized] <condition>
  243. <code>
  244. EndWhile
  245.  
  246.   Executes <code> repeatedly as long as the condition is true. If the
  247.   condition is initially false, the code will never be run. If the
  248.   'optimized' keyword is specified and <code> is a single line, it will be
  249.   run as a command without evaluation (instead of a block of commands and
  250.   statements), which is faster. If the command needs to be evaluated, prefix
  251.   it with 'Eval'.
  252.  
  253. For [optimized] (<init-command>; <condition>; <increment-command>)
  254. <code>
  255. EndFor
  256.  
  257.   Runs <init-command>, then executed <code> repeatedly as long as the
  258.   condition is true, running <increment-command> after each iteration. If
  259.   'Continue' is executed in the code, <increment-command> will still be
  260.   run before the next iteration. If the condition is initially false, the
  261.   code will never be run. The 'optimized' keyword works just like in 'While'.
  262.  
  263. ForEach (<vars>; <list>)
  264. <code>
  265. EndForEach
  266.  
  267.   Breaks <list> up into list elements, then locally assigns them in turn to
  268.   each member of <vars> (which must be a comma-separated list of one or more
  269.   variable names) and runs <code>, repeating until all the list elements have
  270.   been used. Some of the variables will be empty during the last iteration if
  271.   there are not enough list elements to fill them.
  272.  
  273. Switch <text>
  274. [case <text>:
  275. <code>]
  276. [case multi <values>
  277. <code>]
  278. [case range <low>..<high>
  279. <code>]
  280. [case is <relation> <number>
  281. <code>]
  282. [case matches <pattern>
  283. <code>]
  284. [case expr <expression>
  285. <code>]
  286. [case else
  287. <code>]
  288. EndSwitch
  289.  
  290.   Evaluates <text>, locally assigns the result to $@, then executes the code
  291.   for the first case clause that matches. A case clause of the first type
  292.   matches if its text is the same as $@, ignoring case. A 'case multi'
  293.   matches if any one of the <values> (which must be a comma-separated list)
  294.   is the same as $@, ignoring case. A 'case range' matches if $@ is a number
  295.   between <low> and <high>, inclusive. A 'case is' matches if $@ is a number
  296.   that obeys the given relation (for example, 'case is < 100' would match
  297.   when $@ is a number less than 100). A 'case matches' matches when $@ is
  298.   matched by the given wildcard pattern (see $WildMatch() in the function
  299.   reference). A 'case expr' matches when the expression evaluates to true. A
  300.   'case else' matches when no other cases have matched.
  301.   
  302.   There may be only one 'case else', but the other case clauses can occur
  303.   any number of times in any order.
  304.  
  305. MenuTree <tree name>
  306. <tree description>
  307. EndMenuTree
  308.  
  309.   Creates a menu tree with the given name and description. The interpretation
  310.   of <tree name> and <tree description> is up to the host application, which
  311.   might not support menus at all.
  312.  
  313. MenuItem <item name> on <tree name>
  314. <code>
  315. EndMenuTree
  316.  
  317.   Assigns code to a menu item that was previously created by MenuTree. The
  318.   host application may not support menus.
  319.  
  320. Language <name>
  321. <foreign code>
  322. EndLanguage
  323.  
  324.   Runs <foreign code> through the ActiveScripting engine specified by <name>.
  325.   The foreign code has access to an object called 'Versus' with the following
  326.   methods:
  327.     Parse(Text: string): string
  328.       Evaluates Text and returns the result.
  329.     GetVar(Name: string): string
  330.       Returns the value of the variable with the given name.
  331.     Execute(Command: string)
  332.       Evaluates the command, then runs it.
  333.     ExecuteNoEval(Command: string)
  334.       Runs the command without evaluating it.
  335.     SetVar(Name, Value: string)
  336.       Sets the named global variable to the given value.
  337.     SetVarLocal(Name, Value: string)
  338.       Sets the named local variable to the given value. The variable is
  339.       local to the alias/event/menuitem containing the Language statement.
  340.     IncVar(Name: string; Amount: integer)
  341.       Adds the given amount to the value of the named variable.
  342.   ... and the following property:
  343.     State: integer (read-only)
  344.       Contains an integer made by adding together 1 if the enclosing alias,
  345.       event, or menu item was called as a function, and 2 if text output is
  346.       being suppressed.
  347.  
  348. With <text>
  349. <code>
  350. EndWith
  351.  
  352.   Prefixes <text> to each line of <code> (without an intervening space), then
  353.   runs the code.
  354.  
  355. Function Reference
  356. ==================
  357.  
  358. TVSInterp's commands are divided into separate groups, which can be
  359. individually enabled or disabled by the host application:
  360.  
  361. Set Functions
  362. -------------
  363.  
  364. A set is a comma-separated list of words surrounded by square brackets:
  365. [alpha,beta,zappa]. Whitespace, case, and duplicate elements are ignored;
  366. that set is equivalent to [Alpha, Beta  ,ZapPa]. The empty set is [].
  367.  
  368. $AddToSet(<set> <items>)
  369.  
  370.   Returns <set> after cleaning it up and adding all the items from <items>
  371.   (which can be a set or a comma-separated list of items). The list returned
  372.   has no space between items, no duplicate items, and is all lowercase.
  373.  
  374. $RemoveFromSet(<set> <items>)
  375.  
  376.   Returns <set> after cleaning it up and removing all the <items> from it.
  377.  
  378. $IsInSet(<items> <set>)
  379.  
  380.   Returns 1 (true) if all the items from <items> appear in <set>, or 0
  381.   (false) otherwise. <items> can be a set or a comma-separated list of one
  382.   or more items.
  383.  
  384. List Functions
  385. --------------
  386.  
  387. A list is a group of list elements separated by spaces. Each item can take one
  388. of three forms:
  389. 1. A single word, e.g.: foo
  390. 2. One or more words enclosed in double quotes, e.g.: "foo bar"
  391. 3. Any text enclosed in balanced angle brackets, e.g.: <foo <bar baz>>
  392.  
  393. Elements of type 1 and 2 may contain other characters escaped inside them
  394. using backslashes: "\"Hello,\" he said." Functions that return a single element
  395. strip the quoting before returning it.
  396.  
  397. Each list element has a numerical index, starting with zero for the first
  398. element.
  399.  
  400. When a list function expects a pattern or delimiter as a parameter, the
  401. parameter can be quoted into a list item (see $ListQuote()) if it contains
  402. spaces or quote marks.
  403.  
  404. $ListClean(<list>)
  405.  
  406.   Returns the list with multiple spaces between items condensed into a single
  407.   space.
  408.  
  409. $ListDelete(<idx> <list>)
  410.  
  411.   Returns the list after removing the <idx>th element.
  412.  
  413. $ListElementCount(<list>)
  414.  
  415.   Returns the number of elements in the list.
  416.  
  417. $ListFromWords(<words>)
  418.  
  419.   Creates a list that contains each word in <words> as an element in order
  420.   and returns it. This is equivalent to $ListSplit(" " <words>). Use this
  421.   before attempting to use list functions or ForEach on a list of words that
  422.   have not been quoted as list elements but might contain special list
  423.   characters such as backslash.
  424.  
  425. $ListIndex(<idx> <list>)
  426.  
  427.   Extracts the <idx>th element from the list and returns it. The return value
  428.   is empty if there is no element with that number.
  429.  
  430. $ListIndexOf(<pattern> <list>)
  431.  
  432.   Returns the index of the first element in the list that matches the
  433.   pattern.
  434.  
  435. $ListInsert(<idx> <element> <list>)
  436.  
  437.   Returns the list after inserting <element> at the <idx>th position. If
  438.   <idx> is greater than the number of elements in the list, blank elements
  439.   will be inserted at the end before <element>.
  440.  
  441. $ListJoin(<delimiter> <list>)
  442.  
  443.   Concatenates the list's elements by adding <delimiter> in between.
  444.   Any list quoting around the elements will be stripped, so joining the
  445.   elements with a space will not necessarily produce the same list.
  446.  
  447. $ListQuote(<text>)
  448.  
  449.   Returns <text> quoted into a suitable list item. Valid type 3 (angle
  450.   bracket) list items are simply surrounded with another pair of angle
  451.   brackets; other types are scanned through to escape list markers with
  452.   backslashes, then surrounded with double quotes if they contain spaces.
  453.  
  454. $ListRand(<list>)
  455.  
  456.   Returns a random element from the list.
  457.  
  458. $ListRange(<start> <end> <list>)
  459.  
  460.   Returns the list created by extracting elements numbered <start> through
  461.   <end> (inclusive) from <list>.
  462.  
  463. $ListRemove(<pattern> <list>)
  464.  
  465.   Returns the list after removing all elements that match <pattern>.
  466.  
  467. $ListReplace(<start> <end> <element> <list>)
  468.  
  469.   Returns the list after removing all elements from <start> to <end>
  470.   (inclusive) and replacing them with the single element <element>.
  471.  
  472. $ListSearch(<pattern> <list>)
  473.  
  474.   Returns the list created by extracting all the elements that match
  475.   <pattern> from <list>
  476.  
  477. $ListSearchReplace(<pattern> <element> <list>)
  478.  
  479.   Returns the list after replacing all elements that match <pattern> with
  480.   <element>.
  481.  
  482. $ListShuffle(<list>)
  483.  
  484.   Returns the list with the elements rearranged in a random order.
  485.  
  486. $ListSort(<list>)
  487.  
  488.   Returns the list after sorting the elements in ASCII order.
  489.  
  490. $ListSplit(<delimiter> <text>)
  491.  
  492.   Returns the list created by splitting <text> into elements separated by
  493.   <delimiter>.
  494.  
  495. Miscellaneous Functions
  496. -----------------------
  497.  
  498. Functions that deal with character positions number the characters starting at
  499. 1 for the first character.
  500.  
  501. $Asc(<text>)
  502.  
  503.   Returns the ASCII code of the first character of the text.
  504.  
  505. $Char(<num>)
  506.  
  507.   Returns the character with the given ASCII number.
  508.  
  509. $CTime()
  510.  
  511.   Returns the number of seconds Windows has been running.
  512.  
  513. $Date()
  514.  
  515.   Returns the current date in a short format.
  516.  
  517. $DecodeInterval(<seconds>)
  518.  
  519.   Returns the number of seconds as a human-readable string. For example,
  520.   $DecodeInterval(3680) returns "1 hour 1 minute 20 seconds".
  521.  
  522. $DecodeMInterval(<milliseconds>)
  523.  
  524.   Returns the number of milliseconds as a human-readable string. For example,
  525.   $DecodeMInterval(3680711) returns "1 hour 1 minute 20.711 seconds".
  526.  
  527. $Eval(<text>)
  528.  
  529.   Evaluates <text> an additional time, then returns it.
  530.  
  531. $GlobMatch(<string> <pattern>)
  532.  
  533.   Attempts to match <string> against <pattern>, using only classic wildcards,
  534.   and returns true if it succeeds. <string> may contain spaces, but <pattern>
  535.   may not. Classic wildcard patterns can contain the following special
  536.   characters:
  537.  
  538.     ?           matches exactly one character of any value
  539.     *           matches zero or more characters of any value
  540.  
  541.   All other characters are compared directly against the text, ignoring case.
  542.   For example, the pattern "f?o" would match "foo" or "f o" or "flo" but not
  543.   "floo".
  544.  
  545. $GlobMatchCase(<string> <pattern>)
  546.  
  547.   Same as $GlobMatch(), but case-sensitive.
  548.  
  549. $IsNumeric(<text>)
  550.  
  551.   Returns true if the text is an integer. Note that this will return true
  552.   even for numbers that are out of range.
  553.  
  554. $Length(<text>)
  555.  
  556.   Returns the number of characters in the text.
  557.  
  558. $Lower(<text>)
  559.  
  560.   Returns the text converted to lowercase.
  561.  
  562. $MTime()
  563.  
  564.   Returns the number of milliseconds Windows has been running.
  565.  
  566. $NoAttribs(<text>)
  567.  
  568.   Returns <text> after changing all characters produced by backslash
  569.   substitutions back to the original text. For example, $NoAttribs(c:\temp)
  570.   returns "c:\temp", even though the \t is originally interpreted as a tab.
  571.  
  572. $Rand(<range>)
  573.  
  574.   Returns a random number greater than or equal to zero, and less than <range>.
  575.   If <range> is omitted, it is assumed to be 2. 
  576.  
  577. $RStrPos(<needle> <haystack>)
  578.  
  579.   Returns the position of the beginning of the rightmost occurrence of
  580.   <needle> in <haystack>, or 0 if it doesn't appear.
  581.  
  582. $RStrTokL(<token> <text>)
  583.  
  584.   Searches for the rightmost occurrence of <token> in <text> and returns
  585.   everything to the left. If <token> does not appear in <text>, this function
  586.   (and all StrTok functions) pretend that it appears after the end of the text.
  587.   In that case, this function returns the entire string. 
  588.  
  589. $RStrTokR(<token> <text>)
  590.  
  591.   Searches for the rightmost occurrence of <token> and <text> and returns
  592.   everything to the right. If <token> does not appear in <text>, this function
  593.   returns an empty string.
  594.  
  595. $StrPos(<needle> <haystack>)
  596.  
  597.   Returns the position of the beginning of the first occurrence of <needle> in
  598.   <haystack>, or 0 if it doesn't appear.
  599.  
  600. $StrPosFrom(<start> <needle> <haystack>)
  601.  
  602.   Returns the position of the beginning of the first occurrence of <needle>
  603.   in <haystack>, starting the search at the <start>th character. If <needle>
  604.   does not appear, the function returns 0.
  605.  
  606. $StrTokL(<token> <text>)
  607.  
  608.   Searches for the first occurrence of <token> in <text> and returns everything
  609.   to the left. If <token> does not appear in <text>, this function returns the
  610.   entire string.
  611.  
  612. $StrTokR(<token> <text>)
  613.  
  614.   Searches for the first occurrence of <token> in <text> and returns everything
  615.   to the right. If <token> does not apepar in <text>, this function returns an
  616.   empty string.
  617.  
  618. $SubStr(<text> <start> <length>)
  619.  
  620.   Copies and returns up to <length> characters from <text> starting at position
  621.   <start>. If <start> is less than 1 or if <length> is greater than the number
  622.   of characters in the string, fewer characters than specified will be copied.
  623.  
  624. $Time(<format>)
  625.  
  626.   Returns the current time in a format specified by <format>. If <format> is
  627.   omitted, a default short format will be used. The format string may contain
  628.   the following specifiers:
  629.  
  630.     c           displays the date and time in the same default format used by
  631.                 $Date() and $Time() without parameters
  632.     d           displays the day of the month without a leading zero (1-31)
  633.     dd          displays the day of the month with a leading zero (01-31)
  634.     ddd         displays the day of the week as an abbreviation (Sun-Sat)
  635.     dddd        displays the day of the week as a full word (Sunday-Saturday)
  636.     ddddd       displays the date in the same default format used by $Date()
  637.     dddddd      displays the date in a default long format
  638.     m           displays the month number without a leading zero (1-12)
  639.     mm          displays the month number with a leading zero (01-12)
  640.                 (if m or mm follow an h or hh, they display the minute instead
  641.                 of the month, as if n or nn were used instead.)
  642.     mmm         displays the month name as an abbreviation (Jan-Dec)
  643.     mmmm        displays the month name as a full word (January-December)
  644.     yy          displays the year as a two-digit number (00-99)
  645.     yyyy        displays the year as a four-digit number (0000-9999)
  646.     h           displays the hour without a leading zero (0-23)
  647.     hh          displays the hour with a leading zero (00-23)
  648.     n           displays the minute without a leading zero (0-59)
  649.     nn          displays the minute with a leading zero (00-59)
  650.     s           displays the second without a leading zero (0-59)
  651.     ss          displays the second with a leading zero (00-59)
  652.     t           displays the time using the same default format as $Time()
  653.                 without parameters
  654.     tt          displays the time using a default long format
  655.     am/pm       displays "am" if it's before noon or "pm" if it's after
  656.     a/p         displays "a" if it's before noon or "p" if it's after
  657.                 (am/pm and a/p can be written in lower, upper, or mixed case,
  658.                 and the displayed string will change accordingly.)
  659.     ampm        displays a language-specific AM or PM specifier
  660.                 (am/pm, a/p, and ampm all force the preceding h or hh specifier
  661.                 to use a 12-hour clock instead of the default 24-hour clock.)
  662.     /           displays a language-specific date separator
  663.     :           displays a language-specific time separator
  664.     'x' or "x"  text in quotes is displayed as-is, without being formatted
  665.                 as a time string
  666.  
  667. $UnixTime()
  668.  
  669.   Returns the current Unix time (number of seconds since midnight, January 1st,
  670.   1970 GMT).
  671.  
  672. $UnixTime(<unixtime>)
  673.  
  674.   Returns the given Unix time formatted in the same format as $Time(c).
  675.  
  676. $UnixTime(<unixtime> <format>)
  677.  
  678.   Returns the given Unix time formatted using the format string, which is
  679.   interpreted the same way as for $Time(<format>).
  680.  
  681. $Upper(<text>)
  682.  
  683.   Returns the text converted to uppercase.
  684.  
  685. $WildMatch(<string> <pattern>)
  686.  
  687.   Attempts to match <string> against <pattern> and returns true if it succeeds.
  688.   <string> may contain spaces, but <pattern> may not. Wildcard patterns can
  689.   contain the following special characters:
  690.  
  691.     ?           matches exactly one character of any value
  692.     *           matches zero or more characters of any value
  693.     %           matches zero or more of any character except a space
  694.     ¼           (ASCII 172) matches either the end of the string, or a space
  695.                 followed by zero or more characters of any value
  696.     \           escapes the next character so it will not be treated specially
  697.  
  698.   All other characters are compared directly against the text, ignoring case.
  699.   For example, the pattern "f?o" would match "foo" or "f o" or "flo" but not
  700.   "floo". The pattern "f%o" would match "foo" or "fido" but not "f o". The
  701.   pattern "foo¼" would match "foo" or "foo " or "foo bar" but not "food".
  702.   The pattern "how\?" would match "how?" but not "howz".
  703.  
  704. $WildMatchCase(<string> <pattern>)
  705.  
  706.   Same as $WildMatch(), but case-sensitive.
  707.  
  708. $WordCount(<text>)
  709.  
  710.   Returns the number of space-separated words that appear in <text>.
  711.  
  712. Miscellaneous Commands
  713. ----------------------
  714.  
  715. Eval <command>
  716.  
  717.   Evaluates <command> an additional time, then runs it.
  718.  
  719. NoAttribs <command>
  720.  
  721.   Runs the command after changing all characters produced by backslash
  722.   substitutions back to the original text (as in $NoAttribs()). Note that this
  723.   will not affect parameters to functions, since the functions have already
  724.   been called by the time NoAttribs sees the text. To protect function
  725.   parameters, use $NoAttribs().
  726.  
  727. Yield
  728.  
  729.   Causes the host application to process messages and respond to user input.
  730.   This command is typically used to prevent a loop from locking up the
  731.   application.
  732.  
  733. Alias Commands/Functions
  734. ------------------------
  735.  
  736. $AliasExists(<name>)
  737.  
  738.   Returns true if an alias exists with the given name.
  739.  
  740. UnAlias <name>
  741.  
  742.   Removes any alias with the given name.
  743.  
  744. File Commands/Functions
  745. -----------------------
  746.  
  747. IMPORTANT NOTE: Commands and functions that take a filename followed by another
  748. parameter expect the filename to be quoted as a list element to preserve
  749. spaces. This means that backslashes will be treated specially, and not as path
  750. separators. Use $ListQuote() to get around this, e.g.:
  751.   AppendText $ListQuote($filename) $text
  752.  
  753. Commands and functions that only take a filename do not expect the parameter to
  754. be quoted.
  755.  
  756. AppendText <file> <text>
  757.  
  758.   Appends <text> as a new line at the end of <file>. Nothing happens if the
  759.   file does not already exist.
  760.  
  761. ChDir <path>
  762.  
  763.   Attempts to change the current directory to the given path.
  764.  
  765. CreateFile <file>
  766.  
  767.   Creates an empty file with the given name, or empties the file if it already
  768.   exists.
  769.  
  770. $DirExists(<name>)
  771.  
  772.   Returns true if a directory exists with the given name. If no path is given,
  773.   the current directory is searched.
  774.  
  775. $FileExists(<name>)
  776.  
  777.   Returns true if a file exists with the given name. If no path is given,
  778.   the current directory is searched.
  779.  
  780. $GetCurrentDir()
  781.  
  782.   Returns the path to the currect directory.
  783.  
  784. $GetFileDateTime(<file> <format>)
  785.  
  786.   Returns the modification time and date of the given file, formatted according
  787.   to the format string. If <format> is omitted, a default format will be used.
  788.   If the file does not exist, the result is an empty string.
  789.  
  790. $GetFileSize(<file>)
  791.  
  792.   Returns the size in bytes of the file, or an empty string if the file does
  793.   not exist.
  794.  
  795. $GetLinesInFile(<file>)
  796.  
  797.   Returns the number of lines in the given file, or -1 if the file does not
  798.   exist.
  799.  
  800. MkDir <path>
  801.  
  802.   Attempts to create a directory with the given name.
  803.  
  804. $PathExists(<name>)
  805.  
  806.   Equivalent to $DirExists(<name>).
  807.  
  808. $RandomRead(<file>)
  809.  
  810.   Reads a random line from the file and returns it, or returns an empty string
  811.   if the file does not exist.
  812.  
  813. $ReadLine(<number> <file>)
  814.  
  815.   Returns line number <number> (where the first line is 1) from <file>, or
  816.   an empty string if the file does not exist or there is no line with that
  817.   number.
  818.  
  819. RmDir <path>
  820.  
  821.   Attempts to delete the named directory.
  822.  
  823. RmFile <file>
  824.  
  825.   Attempts to remove the named file.
  826.  
  827. File Dialog Functions
  828. ---------------------
  829.  
  830. These functions are only available if both file commands/functions and dialog
  831. commands/functions are enabled. The <filter> string should be a
  832. vertical-bar-separated list of the format:
  833.   Text files (*.txt)|*.txt|All files (*.*)|*.*
  834. where the first segment is a human-readable description of the first file type,
  835. the second segment is a file mask for the first type, the third segment is a
  836. description of the second file type, and so on. Keep in mind that the filter
  837. is only a suggestion, and the dialog will still allow filenames that don't
  838. match it.
  839.  
  840. $OpenDialog(<title>|<filter>)
  841.  
  842.   Displays a standard Windows file open dialog with <title> in the title bar
  843.   and <filter> in the drop-down box. Returns the path to the selected file, or
  844.   an empty string if the user aborts the box by pressing Escape or Cancel. The
  845.   returned file name is not guaranteed to exist.
  846.  
  847. $OpenPictureDialog(<title>|<filter>)
  848.  
  849.   The same as $OpenDialog(), except the dialog will show previews of image
  850.   files as they are selected.
  851.  
  852. $SaveDialog(<title>|<filter>)
  853.  
  854.   Displays a standard Windows file save dialog with <title> in the title bar
  855.   and <filter> in the drop-down box. Returns the path to the chosen file, or
  856.   an empty string if the user aborts the box by pressing Escape or Cancel. The
  857.   dialog will not ask for confirmation if the user selects a file that already
  858.   exists.
  859.  
  860. $SavePictureDialog(<title>|<filter>)
  861.  
  862.   The same as $SaveDialog(), except the dialog will show previews of image
  863.   files as they are selected.
  864.  
  865. Dialog Commands/Functions
  866. -------------------------
  867.  
  868. MessageBox <text>
  869.  
  870.   Displays a message box with an OK button, the application's name in the title
  871.   bar, and <text> inside the window.
  872.  
  873. $MessageDlg(<format> <text>)
  874.  
  875.   Displays a message dialog according to <format> with <text> inside the
  876.   window, and returns a number describing the user's choice. <format> is a
  877.   number made by adding these values, at most one from each group:
  878.  
  879.   Buttons shown:
  880.     0     only show OK button
  881.     1     show OK and Cancel
  882.     2     show Abort, Retry, and Ignore
  883.     3     show Yes, No, and Cancel
  884.     4     show Yes and No
  885.     5     show Retry and Cancel
  886.   Icon shown:
  887.     16    show STOP icon
  888.     32    show question mark icon
  889.     48    show exclamation point icon
  890.     64    show "i" icon
  891.   Default button:
  892.     0     first button is default
  893.     256   second button is default
  894.     512   third button is default
  895.  
  896.   The return value is a number describing which button was chosen:
  897.     1     OK
  898.     2     Cancel
  899.     3     Abort
  900.     4     Retry
  901.     5     Ignore
  902.     6     Yes
  903.     7     No
  904.  
  905. MessageDlg <format> <text>
  906.  
  907.   The same as $MessageDlg(<format> <text>) but discards the return value.
  908.  
  909. Sound commands
  910. --------------
  911.  
  912. Beep
  913.  
  914.   Plays the default system sound.
  915.  
  916. MCI <command>
  917.  
  918.   Sends <command> to Windows's Media Control Interface system. The format of
  919.   these strings is described in the Win32 API specification. Here are a few
  920.   more common commands:
  921.  
  922.   play <filename>
  923.     Plays a media file (WAV, MID, AVI).
  924.   stop <filename>
  925.     Stops playback and rewinds the file.
  926.   pause <filename>
  927.     Pauses playback.
  928.   resume <filename>
  929.     Resumes from where the file was paused.
  930.   record <filename>
  931.     Begins recording a media file.
  932.   stop <filename>
  933.     Stops recording.
  934.   play cdaudio from <num>
  935.     Plays track number <num>.
  936.   stop cdaudio
  937.     Stops CD playback.
  938.  
  939. Clipboard Command/Function
  940. --------------------------
  941.  
  942. $GetClipboard()
  943.  
  944.   Returns the text on the clipboard, or an empty string if there is no text on
  945.   the clipboard.
  946.  
  947. SetClipboard <text>
  948.  
  949.   Sets the clipboard to contain <text>.
  950.  
  951. DDE Command/Function
  952. --------------------
  953.  
  954. $DDE(<service> <topic> <item> <text>)
  955.  
  956.   Attempts to send <text> to the specified DDE server using ExecuteMacro, then
  957.   returns any text that results from it. <item> is treated as a list element,
  958.   so it may contain spaces.
  959.  
  960. DDE <service> <topic> <item> <text>
  961.  
  962.   The same as $DDE(<service> <topic> <item> <text>), but discards any result.
  963.  
  964.